import { createPinia } from 'pinia';
import { createPersistedState } from 'pinia-plugin-persistedstate';
import type { App } from 'vue';

// 创建 pinia 实例
const pinia = createPinia();

pinia.use(
  createPersistedState({
    key: id => `__persisted__${id}`,
    auto: false
  })
);

export function setupStore(app: App) {
  app.use(pinia);
}

const store = pinia;

export { store };
